using UnityEngine;

public class Compass : MonoBehaviour
{
	public RectTransform CompassImage;

	private void Start()
	{
	}

	private void Update()
	{
		if (UnitZ.playerManager.PlayingCharacter != null)
		{
			Vector3 eulerAngles = UnitZ.playerManager.PlayingCharacter.transform.rotation.eulerAngles;
			if (CompassImage != null)
			{
				RectTransform compassImage = CompassImage;
				Vector2 sizeDelta = CompassImage.sizeDelta;
				float x = sizeDelta.x / 360f * eulerAngles.y;
				Vector2 anchoredPosition = CompassImage.anchoredPosition;
				compassImage.anchoredPosition = new Vector2(x, anchoredPosition.y);
			}
		}
	}
}
